<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html class="no-js">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />

<%@ include file="../../include.jsp" %>
<%-- <%@ include file="../../mobilehead_inc.jsp" %> --%>
<script src="${ctx }/mobile/js/jquery.min.js"></script>
<script type="text/javascript" src="${ctx }/js/goods.js"></script>
<script type="text/javascript" src="${ctx }/js/cart.js"></script>
<link href="${ctx }/css/cart.css" rel="stylesheet" type="text/css">

<script type="text/javascript" src="${ctx }/plugin/spinner/js/jquery.spinner.js"></script>
<link href="${ctx }/plugin/spinner/css/jquery.spinner.css" rel="stylesheet" type="text/css">

<title>购物</title>
<script type="text/javascript">

$(document).ready(function()
{	
	
		var cartInfo = GetCartInfo();
		//console.log(cartInfo);
		var cartString = '';		
		if (cartInfo != null)
		{
			for (var i=0; i<cartInfo.length; i++)
			{
				if (i == cartInfo.length -1)
				{
					cartString += cartInfo[i].commodityId;
				}
				else
				{
					cartString += cartInfo[i].commodityId + ",";
				}
			}
		}	
		//console.log(cartString);
		if (cartString.length > 0)
		{
			 $.ajax({
			        url: '${ctx}/mobile/getCartInfo',
			        dataType: "json",
			       // async: true,
			        data:{
			        	ids : cartString
			       
			        },
			        success: function (result) {
			        	//console.log(result.obj);			        	
			        	DisplayCartData(result.obj, cartInfo);
			        },
			        error: function () {
			        	
			        }
			        
			    });			
		}
		if(getCookie('USER_TOKEN') == null||  getCookie('USER_TOKEN')== '""'){
			$(".opa").css("opacity","0.3")
			$("#pay_commit button").attr("disabled", "disabled");
			/* Show("请先登录再结算,5秒后跳转登录页面");
			setTimeout(function(){
				window.location.href = "${ctx }/mobile/goLogin";
				}, 5000); */
			$("body").append('<div  class="tip" style="bottom:50%;background-color: rgb(51,51,51);" onclick="logintip()">请先登录再结算！点击登录</div>');
		}
});
function logintip(){		
		window.location.href = "${ctx}/mobile/goLogin";
}
</script>
</head>


<body>
	<div class="container">
        <div class="title_main">
            <a>购物车</a>
        </div>       
        <div class="opa">        
	        <div id="cart_info">
	            <div id="cart_detail">
	                
	            </div>
	        </div>   
	        <div id="pay_commit">
	            <input type="checkbox" id="check_all" /><label onclick="CheckAll();" name="check_all">全选</label>
	            <button onclick="Settle();">结算</button>
	            <div id="pay_amount">合计：<a>￥ <strong>0.00</strong></a></div>
	        </div>
    	</div>
    </div>        
    <jsp:include page="bottombar.jsp">
	    <jsp:param name="index" value="3"/>
    </jsp:include>    
</body>
</html>